<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Creates a new collection</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongocollection.batchinsert.html">« MongoCollection::batchInsert</a></li>
      <li style="float: right;"><a href="mongocollection.count.html">MongoCollection::count »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongocollection.html">MongoCollection</a></li>
    <li>Creates a new collection</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongocollection.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCollection::__construct</h1>
  <p class="verinfo">(PECL mongo &gt;=0.9.0)</p><p class="refpurpose"><span class="refname">MongoCollection::__construct</span> &mdash; <span class="dc-title">Creates a new collection</span></p>

 </div>


 <div class="refsect1 description" id="refsect1-mongocollection.construct-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>MongoCollection::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="class.mongodb.html" class="type MongoDB">MongoDB</a></span> <code class="parameter">$db</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>)</div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongocollection.construct-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>

      <span class="type"><a href="class.mongodb.html" class="type MongoDB">MongoDB</a></span>
      <code class="parameter">db</code>
     </dt>

     <dd>

      <p class="para">
       Parent database.
      </p>
     </dd>

       
   </dl>

   <dl>

    
     <dt>

      <code class="parameter">name</code>
     </dt>

     <dd>

      <p class="para">
       Name for this collection.
      </p>
     </dd>

       
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongocollection.construct-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a new collection object.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongocollection.construct-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Throws default exception if the collection name is invalid.
  </p>
 </div>

</div></div></div></body></html>